#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

int main()
{
	unsigned int a, b, c, T, i, j;
	scanf("%d", &T);
	for (i = 0; i < T; i++) {
		scanf("%d %d", &a, &b);
		c = a + b;
		for (j = 1; j > 0; j++) {
			if (j != c) {
				printf("%d\n", j);
				break;
			}
		}
	}

	return 0;
}
//5064